﻿@model IEnumerable<vnMcdonald.Models.Product>
        
        @if(ViewBag.currentPage == null){
        <section class="title"><h3>Thực đơn</h3></section>
        <section id="categories">
            <p>
                @foreach(var row in ViewBag.categoies){
                    @Ajax.ActionLink(string.Format((string)row.Name), "Index", "Product", new { CatId = row.CategoryId }, new AjaxOptions
                    {
                        InsertionMode = InsertionMode.Replace,
                        UpdateTargetId = "product",
                        OnSuccess = "$('img.lazy-load').lazyload({ threshold: '2000', effect: 'fadeIn', effectspeed: 2000 })"
                    }, new { @class = (ViewBag.catid==row.CategoryId)?"active":"" })
                }
            </p>
        </section>
        <section class="container-product">
            @foreach(var item in Model){
				<div class="thumb-product">
                    <div class="thumb-img">
					    <img class="lazy-load" src="~/Content/desktop/images/progress.gif" data-original="@item.Images.OrderBy(im => im.Order).FirstOrDefault().Src" alt="@item.Images.OrderBy(im => im.Order).FirstOrDefault().Name" />
                    </div>
                    <div class="content">
						<h3>@item.Name</h3>
						<a class="thumb-link" href="#modal-detail-product" role="button" data-toggle="modal" rel="@item.ProductId" onclick="showDetail(this)">Xem thêm</a>
                        
                        @Ajax.ActionLink("Đặt món", "AddCart", "Cart", new { ProductId = item.ProductId }, new AjaxOptions
                        {
                            HttpMethod = "Post",
                            OnSuccess = "onSuccess"
                        }, new { @class = "btn-order" })
					</div>
				</div>
            }
		</section>
        <div id="loading-product"></div>
        <div id="modal-detail-product" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
        if (ViewBag.catid != null)
        {
            <input type="hidden" value="@ViewBag.catid" id="input-catid" />
        }
        }
        else
        {
            foreach (var item in Model)
            {
                var image = item.Images.Where(im => im.IsActive == 1).OrderBy(im => im.Order).FirstOrDefault();
				<div class="thumb-product page-@ViewBag.currentPage">
                    <div class="thumb-img">
					    <img class="lazy-load" src="~/Content/desktop/images/progress.gif" data-original="@image.Src" alt="@image.Name" />
                    </div>
                    <div class="content">
						<h3>@item.Name</h3>
						<a class="thumb-link" href="#modal-detail-product" role="button" data-toggle="modal" rel="@item.ProductId" onclick="showDetail(this)">Xem thêm</a>
                        
                        @Ajax.ActionLink("Đặt món", "AddCart", "Cart", new { ProductId = item.ProductId }, new AjaxOptions
                        {
                            HttpMethod = "Post",
                            OnSuccess = "onSuccess"
                        }, new { @class = "btn-order" })
					</div>
				</div>
            }
        }

